unit untExibeCNPJ;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxContainer, cxEdit, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinFoggy,
  dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
  dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSharp, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
  dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinXmas2008Blue, Menus, DB, StdCtrls, cxButtons, cxTextEdit, cxDBEdit,
  cxLabel, cxGroupBox, ADODB, ACBrBase, ACBrEnterTab, cxMaskEdit;

type
  TfrmExibeCNPJ = class(TForm)
    QryClientes: TADOQuery;
    QryClientescnpj: TWideStringField;
    cxGroupBox1: TcxGroupBox;
    Label1: TcxLabel;
    cxDBTextEdit4: TcxDBTextEdit;
    cxLabel1: TcxLabel;
    dsCNPJ: TDataSource;
    cxButton2: TcxButton;
    cxButton1: TcxButton;
    cxButton3: TcxButton;
    edtcnpj: TcxDBMaskEdit;
    ACBrEnterTab1: TACBrEnterTab;
    QryClientestipo: TWideStringField;
    procedure FormShow(Sender: TObject);
    procedure cxButton3Click(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmExibeCNPJ: TfrmExibeCNPJ;

implementation

uses untDmPrincipal;

{$R *.dfm}

procedure TfrmExibeCNPJ.FormShow(Sender: TObject);
begin
  if QryClientestipo.Value = 'F' then
    edtcnpj.Properties.EditMask := '###.###.###-##;1;_'
  else
    edtcnpj.Properties.EditMask := '##.###.###/####-##;1;_';
end;

procedure TfrmExibeCNPJ.cxButton3Click(Sender: TObject);
begin
  if not FileExists(dmPrincipal.formcaixacfg) then
     Application.MessageBox('Defina um caminho para o Form. Caixa','Aviso',mb_ok+mb_iconerror)
  else
    WinExec(Pchar(dmPrincipal.formcaixacfg), SW_SHOW);
end;

procedure TfrmExibeCNPJ.cxButton1Click(Sender: TObject);
begin
  if not FileExists(dmPrincipal.siriccfg) then
     Application.MessageBox('Defina um caminho para o SIRIC','Aviso',mb_ok+mb_iconerror)
  else
    WinExec(Pchar(dmPrincipal.siriccfg), SW_SHOW);
end;

procedure TfrmExibeCNPJ.cxButton2Click(Sender: TObject);
begin
  close;
end;

procedure TfrmExibeCNPJ.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_escape then
    close;
end;

end.
